package design_pattern.builder;

/**
 * Created by WeiDingKuo on 2017/10/26 15:36
 * <p>
 * 建造者模式
 * 处理复杂对象的创建，由builder和director配合实现
 * 将复杂对象拆分成各个组件，然后由director（包工头儿）调度由builder（农民工）分别创建、组装
 */
public class Test {
    public static void main(String[] args) {
        Person man = new BuilderDirector(new BuildMan(new Person())).buildPerson();
        Person woman = new BuilderDirector(new BuildWoman(new Person())).buildPerson();

        System.out.println(man.getHead());
        System.out.println(man.getBody());
        System.out.println(man.getHand());
        System.out.println(man.getFoot());
        System.out.println("==========");
        System.out.println(woman.getHead());
        System.out.println(woman.getBody());
        System.out.println(woman.getHand());
        System.out.println(woman.getFoot());
    }
}
